package com.luo.wheresmytakeaway.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class Results {
    private Integer code;
    // 响应码
    private String message;
    // 响应信息
    private Object data;

    public Results(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    // 响应数据
    public static Results success() {
        return new Results(1, "success", null);
    }

    // 成功
    public static Results success(Object data) {
        return new Results(1, "success", data);
    }

    // 成功并且带参返回
    public static Results error(String msg) {
        return new Results(0, msg, null);
    }
    // 失败
}
